% Brief Introduction:
% Spline1dNode computes the interpolation node given the preset break point
% vector and the polynomial order. This function is simplified from the 
% function written by Paul L. Fackler & Mario J. Miranda.
% Usage:
%   [B]=Spline1dNode(SplineSpace,x,order);
% Inputs:
%   breaks      :    Vector of break points, accendingly sorted
%   k           :    Polynomial order of the spline
% OUTPUTS
%   Node        :    Node Vector
%
% Note: The number of basis functions is n=size(breaks,1)+k-1
% Author:       Xing Guo, University of Michigan, xingguo@umich.edu
% Version:      Nov 30, 2017   


function Node=Spline1dNode(breaks,k)

if nargin<2 
    error('Two parameters need to be provided!'); 
end

a           =   breaks(1);
b           =   breaks(end);
n           =   length(breaks)+k-1;
Node        =   cumsum([a*ones(k,1);breaks(:);b*ones(k,1)]);
Node        =   (Node(1+k:n+k)-Node(1:n))/k;
Node(1)     =   a;
Node(end)   =   b;